import { getTenantId } from './../projectIndicators.config';
import moment from 'moment';
moment.locale('zh-cn');

export default function getFormItems(params) {
    return [
        {
            attrcode: 'scode',
            label: '项目编码',
            required: true,
            itemtype: 'refer',
            refType: 'grid',
            reqRef: {
                columns: [
                    { title: '项目编码', key: 'scode' },
                    { title: '项目名称', key: 'sname' },
                ],
                refPk: 'pkProject',
                refUrl: '/projectInTeam/list',
                refMethod: 'get',
                resultPath: 'objects',
                fieldDisplayed: 'sname',
                fieldValued: 'scode',
                refQueryCondition: () => {
                    return { pkTenant: getTenantId(), projectState: '-2' }
                },
                isMultiSelectedEnabled: false,
                fieldDisplayed: 'scode',
                filterColumn: ['sname','scode'],
            }
        },
        {
            attrcode: 'sname',
            label: '项目名称',
            required: true,
            disabled: true
        },
        {
            attrcode: 'orgName',
            label: '项目组织',
            required: false,
            disabled: true
        },
        {
            attrcode: 'pkProject',
            visible: false
        },
        {
            attrcode: 'position',
            label: '地理位置',
            required: false,
            visibleEdit: false,
        },
        {
            attrcode: 'strBillstatus',
            label: '单据状态',
            required: false,
            disabled: true,
            placeholder: '自由态'
        },
        {
            attrcode: 'repeatDate',
            label: '复工日期',
            required: true,
            itemtype: 'date',
            defaultValue: { value: moment(new Date()) }
        },
        {
            attrcode: 'repeatReason',
            label: '复工说明',
            itemtype: 'textarea',
            isnextrow: true,
            required: true,
            col: 12
        },
        {
            itemtype: "refer",
            refType: 'grid',
            attrcode: 'userId',
            label: "抄送人",
            isnextrow: true,
            col: 12,
            required: false,
            reqRef: {
                refQueryCondition: () => {
                    let project = this.props.form.getFormItemValue('pkProject');
                    return { projectid: project && project.value };
                },
                method: 'get',
                refPk: 'pkUser',
                isMultiSelectedEnabled: true,
                fieldDisplayed: 'userName',
                fieldValued: 'pkUser',
                refUrl: "/team/members",
                columns: [
                    { title: '抄送人', key: 'userName' }
                ]
            },
        },
    ]
}